//
//  ViewController.m
//  IOS-image2
//
//  Created by RIOS on 2018/3/27.
//  Copyright © 2018年 RIOS. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *image;
- (IBAction)btnUp:(id)sender;
- (IBAction)btnRight:(id)sender;
- (IBAction)btnDown:(id)sender;
- (IBAction)btnLeft:(id)sender;
- (IBAction)btnBig:(id)sender;
- (IBAction)btnSmall:(id)sender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)btnUp:(id)sender {
    [self movey:-100];
}

- (IBAction)btnRight:(id)sender {
    [self movex:100];
}

- (IBAction)btnDown:(id)sender {
    [self movey:100];
}

- (IBAction)btnLeft:(id)sender {
    [self movex:-100];
}

- (IBAction)btnBig:(id)sender {
    [self zoom:100];
}

- (IBAction)btnSmall:(id)sender {
    [self zoom:-100];
}

- (void)movex:(int)size{
    CGRect frame = self.image.frame;
    frame.origin.x +=size;
    [UIView animateWithDuration:0.5 animations:^{
        self.image.frame = frame;
    }];
    
}

- (void)zoom:(int)size{
    CGRect frame = self.image.frame;
    frame.size.height +=size;
     frame.size.width +=size;
    [UIView animateWithDuration:0.5 animations:^{
        self.image.frame = frame;
    }];
    
}


- (void)movey:(int)size{
    CGRect frame = self.image.frame;
    frame.origin.y +=size;
    [UIView animateWithDuration:0.5 animations:^{
        self.image.frame = frame;
    }];
    
}



@end
